package com.ruoyi.web.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.web.domain.JjmOrder;
import com.ruoyi.web.mapper.OPayMapepr;
import com.ruoyi.web.mapper.JjmOrderMapper;
import com.ruoyi.web.service.IJjmOrderService;
import com.ruoyi.web.domain.vo.JjmOrderVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.ArrayList;
import java.util.List;

/**
 * 订单Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-07-16
 */

@Service
public class JjmOrderServiceImpl extends ServiceImpl<JjmOrderMapper, JjmOrder> implements IJjmOrderService {
    @Autowired
    private JjmOrderMapper orderMapper;
    @Autowired
    private OPayMapepr payMapepr;
//
//    @Override
//    public PageData<JjmOrderVO> page(JjmOrder vo, Integer pageNum, Integer pageSize) {
//
//        List<JjmOrderVO> voList = new ArrayList<>();
//        JjmOrderVO orderVO = new JjmOrderVO();
//        LambdaQueryWrapper<JjmOrder> queryWrapper = new LambdaQueryWrapper<>();
//        queryWrapper.eq(JjmOrder::getId,"1");
//        List<JjmOrder> jjmOrders = orderMapper.selectList(queryWrapper);
//        for (JjmOrder jjmOrder : jjmOrders) {
//            BeanUtils.copyProperties(jjmOrder,orderVO);
//        }
//        List<String> list = new ArrayList<>();
//        list.add("wwwww.aaaa");
//        orderVO.setImageList(list);
//
//        voList.add(orderVO);
//        return new PageData<>(voList,pageNum,pageSize);
//    }

    @Override
    public int add(JjmOrder jjmOrder) {
        int insert = orderMapper.insert(jjmOrder);
        return 1;
    }

    @Override
    public List<JjmOrderVO> orderList(JjmOrder jjmOrder) {
        List<JjmOrderVO> voList = new ArrayList<>();
        JjmOrderVO orderVO = new JjmOrderVO();
        LambdaQueryWrapper<JjmOrder> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(JjmOrder::getId,"1");
        List<JjmOrder> jjmOrders = orderMapper.selectList(queryWrapper);
        for (JjmOrder jjmOrdera : jjmOrders) {
            BeanUtils.copyProperties(jjmOrdera,orderVO);
        }
        List<String> list = new ArrayList<>();
        list.add("wwwww.aaaa");
        orderVO.setImageList(list);

        voList.add(orderVO);
        return voList;
    }
}
